/*
 * Copyright ©2015-2021 Jaemon. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gitee.jaemon.spring.adorner.type;

import java.lang.reflect.Parameter;
import java.util.Map;

/**
 * 参数定义实体
 *
 * @author Jaemon
 * @since 1.0
 */
public class ParamDefinition {
    /** 参数类型 */
    private Class<?> parameterType;
    /** 参数信息 */
    private Parameter parameter;
    /** 参数信息, 泛型: Map, 具体类型: Field */
    private Map<String, Object> params;

    ParamDefinition(Class<?> parameterType, Parameter parameter, Map<String, Object> params) {
        this.parameterType = parameterType;
        this.parameter = parameter;
        this.params = params;
    }

    /**
     * 实例化ParamDefinition对象
     *
     * @param parameterType
     *          参数类型
     * @param params
     *          参数信息, 泛型: Map, 具体类型: Field
     * @return
     *          paramDefinition {@link ParamDefinition}
     */
    public static ParamDefinition of(Class<?> parameterType, Map<String, Object> params) {
        return new ParamDefinition(parameterType, null, params);
    }

    /**
     * 实例化ParamDefinition对象
     *
     * @param parameterType
     *          参数类型
     * @param parameter
     *          参数信息
     * @param params
     *          参数信息, 泛型: Map, 具体类型: Field
     * @return
     *          paramDefinition {@link ParamDefinition}
     */
    public static ParamDefinition of(Class<?> parameterType, Parameter parameter, Map<String, Object> params) {
        return new ParamDefinition(parameterType, parameter, params);
    }

    public Class<?> getParameterType() {
        return parameterType;
    }

    public Parameter getParameter() {
        return parameter;
    }

    public Map<String, Object> getParams() {
        return params;
    }
}